﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;

namespace YLPublicService.TransferModel
{
    [Flags]
    [DataContract]
    public enum WorkItemStatus
    {
        [EnumMember]
        WaitingProcess = 1,
        [EnumMember]
        Processing,
        [EnumMember]
        ProcessFinish,
        [EnumMember]
        Downloaded,
        [EnumMember]
        Uploading,
        [EnumMember]
        Downloading
    }
    public static class StatusExtension
    {
        public static string GetDiscription(this WorkItemStatus status)
        {
            string dip = "";
            switch (status)
            {
                case WorkItemStatus.WaitingProcess:
                    dip = "待制作";
                    break;
                case WorkItemStatus.Processing:
                    dip = "正在制作";
                    break;
                case WorkItemStatus.ProcessFinish:
                    dip = "制作完成";
                    break;
                case WorkItemStatus.Downloaded:
                    dip = "下载完成";
                    break;
                case WorkItemStatus.Uploading:
                    dip = "正在上传";
                    break;
                case WorkItemStatus.Downloading:
                    dip = "正在下载";
                    break;
                default:
                    throw new ArgumentException("不存在这种workitem状态");
            }
            return dip;
        }
        public static int GetID(this WorkItemStatus status)
        {
            return (int)status;
        }
        public static WorkItemStatus ToStatusEnum(this int i)
        {
            return (WorkItemStatus)i;
        }
    }


}